<div class="job-link span2">
  <a href="/[[ job.project.name || project.name ]]/[[ job.nojobs ? '' : 'job/' + job._id ]]">
    <i ng-hide="job.nojobs"
       data-toggle="tooltip"
       title="[[ job.status ]]"
       class="fa [[ statusClasses[job.status] ]] fa-2x"></i>
    <span class="job-link-id" ng-show="job.nojobs">No job history</span>
    <span class="job-link-id" data-test="job-id">[[ job._id.substr(0,8) ]]</span>
  </a>
</div>

<div class="committer [[ job.trigger.author.url ? 'span2' : 'span1']]">
  <div ng-show="job.trigger.author.image" ng-switch="!!job.trigger.author.url">
    <img ng-switch-when="false" ng-src="[[ job.trigger.author.image ]]" class="img-circle"/>
    <a ng-switch-default href="[[ job.trigger.author.url ]]" target="_blank">
      <img ng-src="[[ job.trigger.author.image ]]" class="img-circle"/>
    </a>
  </div>
</div>

<div class="branch span2">
  <span>[[ job.ref.branch ]]</span>
</div>

<div class="commit-url [[ job.trigger.author.url ? 'span2' : 'span3']]" ng-switch="!!job.trigger.url">
  <span ng-switch-when="true">
    <a href="[[ job.trigger.url ]]" target="_blank">
      <span class="small-text pull-left truncate" title="[[ job.trigger.message ]]">
        <i class="trigger-icon fa fa-[[ triggers[job.trigger.type].icon ]]" data-toggle="tooltip" title="[[ triggers[job.trigger.type].title ]]"></i>
        [[ job.trigger.message ]]
      </span>
    </a>
  </span>

  <span class="small-text pull-left" ng-switch-default title="[[ job.trigger.message ]]">
    <i class="trigger-icon fa fa-[[ triggers[job.trigger.type].icon ]]" data-toggle="tooltip" title="[[ triggers[job.trigger.type].title ]]"></i>
    [[ job.trigger.message ]]
  </span>
</div>

<div class="run-time span2" ng-switch="job.status">
  <time ng-switch-when="running" class="duration" since="[[ job.created ]]" ng-hide="job.nojobs"></time>
  <time ng-switch-when="submitted" class="duration" since="[[ job.started ]]" ng-hide="job.nojobs"></time>
  <time ng-switch-default class="duration" duration="[[ job.duration ]]" ng-hide="job.nojobs"></time>
</div>

<div class="finished-at span2" ng-switch="job.status === 'running'">
  <span ng-switch-when="false" class="small-text" ng-hide="job.nojobs || job.status === 'submitted'">
    <time data-toggle="tooltip" data-placement="top" datetime="[[ job.finished ]]" class="timeago summary-text"></time>
  </span>

  <div ng-switch-when="true" class="progress-meter">
    <div class="progress progress-striped active progress-info">
      <div class="bar" style="width:[[ (phases.indexOf(job.phase)+1)/phases.length*100 ]]%; max-width: 100%"></div>
    </div>
  </div>

  <div class="current-build-menu dropdown pull-right">
    <div class="dropdown-toggle btn btn-link" data-toggle="dropdown">
      <i class="fa fa-ellipsis-v"></i>
    </div>
    <ul class="dropdown-menu">
      {% if currentUser %}
        <li ng-show="job.status === 'running' || job.status === 'submitted'">
          <a ng-click="cancelJob(job._id)">
            <i class="fa fa-times"></i> Cancel Job
          </a>
        </li>
      {% endif %}
      <li>
        <a ng-click="restartJob(job)" disabled="[[ job.status === 'running' || job.status === 'submitted' ? true : false ]]">
          <i class="fa fa-retweet"></i> Restart Job
        </a>
      </li>
    </ul>
  </div>
</div>
